import "../node_modules/dayjs/dayjs.min.js";
const InputType = 1;
const InputNumType = 2;
const SelectType = 3;
const DatePickType = 4;
const CascaderType = 5;
const TreeSelectType = 6;
const SlotType = 99;
const DefaultItemMargin = "0 0 15px 0";
const DefaultOpProp = {
  labelKey: "label",
  valueKey: "value"
};
function initFormModel(option, model) {
  model = model || {};
  if (option && option.list) {
    for (let i = 0; i < option.list.length; i++) {
      const item = option.list[i];
      if (Array.isArray(item.name)) {
        for (let i2 = 0; i2 < item.name.length; i2++) {
          if (item.defaultValue && item.defaultValue.length > i2) {
            model[item.name[i2]] = item.defaultValue[i2] || "";
          } else {
            model[item.name[i2]] = "";
          }
        }
      } else {
        model[item.name] = item.defaultValue || "";
      }
      if (item.nameAs) {
        if (Array.isArray(item.nameAs)) {
          for (let i2 = 0; i2 < item.nameAs.length; i2++) {
            if (item.defaultValue && item.defaultValue.length > i2) {
              model[item.nameAs[i2]] = item.defaultValue[i2] || "";
            } else {
              model[item.nameAs[i2]] = "";
            }
          }
        } else {
          model[item.nameAs] = item.defaultValue || "";
        }
      }
    }
  }
  return model;
}
function withInstall(comp) {
  comp.install = (app) => {
    const name = comp.name || comp.__name;
    app.component(name, comp);
  };
  return comp;
}
export {
  CascaderType,
  DatePickType,
  DefaultItemMargin,
  DefaultOpProp,
  InputNumType,
  InputType,
  SelectType,
  SlotType,
  TreeSelectType,
  initFormModel,
  withInstall
};
